package lab03.test04;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test04 {
    public static void main(String[] args) {
        String source="D:\\java实验\\source\\high.mp3";
        String target="D:\\java实验\\target\\1.mp3";
        FileInputStream fileInputStream=null;
        FileOutputStream fileOutputStream=null;

        try {
            fileInputStream =new FileInputStream(source);
            fileOutputStream=new FileOutputStream(target);

            int data;

            //读一个字节写入一个字节
            while ((data=fileInputStream.read())!=-1){
                fileOutputStream.write(data);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                fileInputStream.close();
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
    }
}
